package com.system.blogAdmin.blog.dto;

import com.cnc.common.lang.annotation.Label;
import com.cnc.common.lang.entity.BaseEntity;

import java.sql.Date;

/**
 * 作者： cnc
 * 创建时间：2017-06-22.
 * 版本：1.0
 */
public class CategoryDto extends BaseEntity {
    @Label("类别名")
    private String name;
    @Label("父id")
    private Integer pid;
    @Label("创建时间")
    private Date createTime;
    @Label("创建人id")
    private Integer createId;

    private Integer _parentId;


    public Integer get_parentId() {
        return _parentId;
    }

    public void set_parentId(Integer _parentId) {
        this._parentId = _parentId;
    }

    public String getName(){return this.name;}
    public void setName(String name){this.name = name;}

    public Date getCreateTime(){return this.createTime;}
    public void setCreateTime(Date createTime){this.createTime = createTime;}

    public Integer getCreateId(){return this.createId;}
    public void setCreateId(Integer createId){this.createId = createId;}

    public Integer getPid(){return this.pid;}
    //这里注意！！！！
    //用easyUI的treegrid来显示树状图时，_parentId的根目录必须为null，不然整棵树将不会显示！！！！！！
    public void setPid(Integer pid){
        this.pid = pid;
        if(pid == 0){
            this._parentId = null;
        }else {
            this._parentId = pid;
        }
    }
    @Override
    public String toString() {
        return "BlogCategory{"+"name:"+name+","+"pid:"+pid+","+"createTime:"+createTime+","+"createId:"+createId+"_parentId:"+_parentId+"}";
    }
}
